/*--------------------------------------------------------------
 * File: demo31.c 编码类型：C语言  UTF-8
 * Author WRS (1352509846@qq.com)
 * 功能: 判断素数
 * Version 0.1
 * Date 2022-01-27 
 * 
 * @copyright Copyright (c) 2022
 * 
----------------------------------------------------------------*/
#include <stdio.h>

int main(int argc, char const *argv[])
{
    int n, i, flag = 0;
    printf("请输入一个正整数：");
    scanf("%d",&n);
    for(i=2; i<=n/2; i++)
    {
        if(n%i == 0)
        {
            printf("%d不是素数\n",n);
            return 1;
        }
    }
    printf("%d是素数\n",n);
    return 0;
}
